home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / var / log / scripts / glibc-2.7-i486-16 < prev    next >
Encoding:
Text File  |  2008-11-21  |  7.1 KB  |  194 lines

  1. #!/bin/sh
  2. # Copyright (C) 2002, 2005  Slackware Linux, Inc.
  3. # Copyright 2005, 2006, 2007  Patrick J. Volkerding, Sebeka, Minnesota, USA
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # Swap glibc on the fly.
  16. #
  17. # If we're on a running system we have to handle this _very_ carefully.  :-)
  18. # The tricks involved here get trickier every time...
  19.  
  20. # OK, now we have to be sure of a few things.  First, you do have a 2.6
  21. # kernel running, right?
  22.  
  23. if [ -r /proc/ksyms ]; then
  24.   echo "FATAL: you need to be running a 2.6.x kernel in order to upgrade"
  25.   echo "to this version of glibc."
  26.   echo
  27.   sleep 999
  28.   exit 1
  29. fi
  30.  
  31. # Next, stop using the /lib/ntpl libraries.  These are now obsolete and
  32. # will break the installation if present:
  33. if [ -d lib/tls ]; then
  34.   mkdir -p lib/obsolete
  35.   mv lib/tls lib/obsolete
  36. fi
  37. if [ -x sbin/ldconfig ]; then
  38.   sbin/ldconfig -r .
  39. fi
  40.  
  41. # Install NPTL glibc libraries:
  42. if [ -x /sbin/ldconfig -a -d lib/incoming ]; then # swap on the fly
  43.   # First create copies of the incoming libraries:
  44.   ( cd lib/incoming
  45.     for file in * ; do
  46.       if [ ! -r ../${file}.incoming ]; then
  47.         cp -a $file ../${file}.incoming
  48.       fi
  49.     done
  50.   )
  51.   # Then switch to them all at once:
  52.   /sbin/ldconfig -l lib/*.incoming 2> /dev/null
  53.   # Finally, rename them and clean up:
  54.   ( cd lib
  55.     for file in *.incoming ; do
  56.       rm -f `basename $file .incoming`
  57.       cp -a $file `basename $file .incoming`
  58.       /sbin/ldconfig -l `basename $file .incoming`
  59.       rm -f $file
  60.     done
  61.   )
  62. else # no ldconfig?  Good, it's safe to just jam it on home (and make links below):
  63.   ( cd lib/incoming
  64.     for file in * ; do
  65.       cp -a $file ..
  66.     done
  67.   )
  68. fi
  69. # Now, get rid of the temporary directory:
  70. rm -rf lib/incoming
  71. # Done installing NPTL glibc libraries.
  72.  
  73. # Timezone stuff:
  74. if [ -L etc/localtime -a ! -r etc/localtime-copied-from ]; then
  75.   mv etc/localtime etc/localtime-copied-from
  76.   chroot . /bin/cp etc/localtime-copied-from etc/localtime
  77. fi
  78. # Add the default timezone in /etc, if none exists:
  79. if [ ! -r etc/localtime ]; then
  80.   ( cd etc ; rm -rf localtime localtime-copied-from )
  81.   ( cd etc ; ln -sf /usr/share/zoneinfo/Factory localtime-copied-from )
  82.   chroot . /bin/cp etc/localtime-copied-from etc/localtime
  83. fi
  84. # Add the default link in /usr/share/zoneinfo, if none exists:
  85. if [ ! -L usr/share/zoneinfo/localtime ]; then
  86.   ( cd usr/share/zoneinfo ; rm -rf localtime )
  87.   ( cd usr/share/zoneinfo ; ln -sf /etc/localtime localtime )
  88. fi
  89. ( cd usr/share/zoneinfo ; rm -rf timeconfig )
  90. ( cd usr/share/zoneinfo ; ln -sf /usr/sbin/timeconfig timeconfig )
  91.  
  92. # Handle config files:
  93. config() {
  94.   NEW="$1"
  95.   OLD="$(dirname $NEW)/$(basename $NEW .new)"
  96.   # If there's no config file by that name, mv it over:
  97.   if [ ! -r $OLD ]; then
  98.     mv $NEW $OLD
  99.   elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
  100.     rm $NEW
  101.   fi
  102.   # Otherwise, we leave the .new copy for the admin to consider...
  103. }
  104. config etc/nscd.conf.new
  105. config etc/profile.d/glibc.csh.new
  106. config etc/profile.d/glibc.sh.new
  107. # Clearly you already decided this issue.  :-)
  108. rm -f etc/profile.d/glibc.csh.new
  109. rm -f etc/profile.d/glibc.sh.new
  110.  
  111. # In case there's no ldconfig, make the links manually:
  112. if [ ! -x /sbin/ldconfig ]; then
  113. # linuxthreads:
  114. ( cd lib ; rm -rf libnss_nis.so.2 )
  115. ( cd lib ; ln -sf libnss_nis-2.7.so libnss_nis.so.2 )
  116. ( cd lib ; rm -rf libm.so.6 )
  117. ( cd lib ; ln -sf libm-2.7.so libm.so.6 )
  118. ( cd lib ; rm -rf libnss_files.so.2 )
  119. ( cd lib ; ln -sf libnss_files-2.7.so libnss_files.so.2 )
  120. ( cd lib ; rm -rf libresolv.so.2 )
  121. ( cd lib ; ln -sf libresolv-2.7.so libresolv.so.2 )
  122. ( cd lib ; rm -rf libnsl.so.1 )
  123. ( cd lib ; ln -sf libnsl-2.7.so libnsl.so.1 )
  124. ( cd lib ; rm -rf libutil.so.1 )
  125. ( cd lib ; ln -sf libutil-2.7.so libutil.so.1 )
  126. ( cd lib ; rm -rf libnss_compat.so.2 )
  127. ( cd lib ; ln -sf libnss_compat-2.7.so libnss_compat.so.2 )
  128. ( cd lib ; rm -rf libthread_db.so.1 )
  129. ( cd lib ; ln -sf libthread_db-1.0.so libthread_db.so.1 )
  130. ( cd lib ; rm -rf libnss_hesiod.so.2 )
  131. ( cd lib ; ln -sf libnss_hesiod-2.7.so libnss_hesiod.so.2 )
  132. ( cd lib ; rm -rf libanl.so.1 )
  133. ( cd lib ; ln -sf libanl-2.7.so libanl.so.1 )
  134. ( cd lib ; rm -rf libcrypt.so.1 )
  135. ( cd lib ; ln -sf libcrypt-2.7.so libcrypt.so.1 )
  136. ( cd lib ; rm -rf libBrokenLocale.so.1 )
  137. ( cd lib ; ln -sf libBrokenLocale-2.7.so libBrokenLocale.so.1 )
  138. ( cd lib ; rm -rf ld-linux.so.2 )
  139. ( cd lib ; ln -sf ld-2.7.so ld-linux.so.2 )
  140. ( cd lib ; rm -rf libdl.so.2 )
  141. ( cd lib ; ln -sf libdl-2.7.so libdl.so.2 )
  142. ( cd lib ; rm -rf libnss_dns.so.2 )
  143. ( cd lib ; ln -sf libnss_dns-2.7.so libnss_dns.so.2 )
  144. ( cd lib ; rm -rf libpthread.so.0 )
  145. ( cd lib ; ln -sf libpthread-2.7.so libpthread.so.0 )
  146. ( cd lib ; rm -rf libnss_nisplus.so.2 )
  147. ( cd lib ; ln -sf libnss_nisplus-2.7.so libnss_nisplus.so.2 )
  148. ( cd lib ; rm -rf libc.so.6 )
  149. ( cd lib ; ln -sf libc-2.7.so libc.so.6 )
  150. ( cd lib ; rm -rf librt.so.1 )
  151. ( cd lib ; ln -sf librt-2.7.so librt.so.1 )
  152. fi
  153.  
  154. # More links:
  155. ( cd usr/lib ; rm -rf libnss_nisplus.so )
  156. ( cd usr/lib ; ln -sf ../../lib/libnss_nisplus.so.2 libnss_nisplus.so )
  157. # This is now a linker script:
  158. #( cd usr/lib ; rm -rf libpthread.so )
  159. #( cd usr/lib ; ln -sf ../../lib/libpthread.so.0 libpthread.so )
  160. ( cd usr/lib ; rm -rf libresolv.so )
  161. ( cd usr/lib ; ln -sf ../../lib/libresolv.so.2 libresolv.so )
  162. ( cd usr/lib ; rm -rf libnsl.so )
  163. ( cd usr/lib ; ln -sf ../../lib/libnsl.so.1 libnsl.so )
  164. ( cd usr/lib ; rm -rf libnss_hesiod.so )
  165. ( cd usr/lib ; ln -sf ../../lib/libnss_hesiod.so.2 libnss_hesiod.so )
  166. ( cd usr/lib ; rm -rf libnss_files.so )
  167. ( cd usr/lib ; ln -sf ../../lib/libnss_files.so.2 libnss_files.so )
  168. ( cd usr/lib ; rm -rf libm.so )
  169. ( cd usr/lib ; ln -sf ../../lib/libm.so.6 libm.so )
  170. ( cd usr/lib ; rm -rf libutil.so )
  171. ( cd usr/lib ; ln -sf ../../lib/libutil.so.1 libutil.so )
  172. ( cd usr/lib ; rm -rf libnss_compat.so )
  173. ( cd usr/lib ; ln -sf ../../lib/libnss_compat.so.2 libnss_compat.so )
  174. ( cd usr/lib ; rm -rf libthread_db.so )
  175. ( cd usr/lib ; ln -sf ../../lib/libthread_db.so.1 libthread_db.so )
  176. ( cd usr/lib ; rm -rf libcrypt.so )
  177. ( cd usr/lib ; ln -sf ../../lib/libcrypt.so.1 libcrypt.so )
  178. ( cd usr/lib ; rm -rf libBrokenLocale.so )
  179. ( cd usr/lib ; ln -sf ../../lib/libBrokenLocale.so.1 libBrokenLocale.so )
  180. ( cd usr/lib ; rm -rf libdl.so )
  181. ( cd usr/lib ; ln -sf ../../lib/libdl.so.2 libdl.so )
  182. ( cd usr/lib ; rm -rf libnss_dns.so )
  183. ( cd usr/lib ; ln -sf ../../lib/libnss_dns.so.2 libnss_dns.so )
  184. ( cd usr/lib ; rm -rf librt.so )
  185. ( cd usr/lib ; ln -sf ../../lib/librt.so.1 librt.so )
  186. ( cd usr/lib ; rm -rf libanl.so )
  187. ( cd usr/lib ; ln -sf ../../lib/libanl.so.1 libanl.so )
  188. ( cd usr/lib ; rm -rf libnss_nis.so )
  189. ( cd usr/lib ; ln -sf ../../lib/libnss_nis.so.2 libnss_nis.so )
  190. ( cd usr/share/zoneinfo ; rm -rf localtime )
  191. ( cd usr/share/zoneinfo ; ln -sf /etc/localtime localtime )
  192. ( cd bin ; rm -rf sln )
  193. ( cd bin ; ln -sf /sbin/sln sln )
  194.